package com.learn.liquibase.controller;

import com.learn.liquibase.entity.Person;
import com.learn.liquibase.service.PersonService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * 测试接口
 *
 * @author zhousiqi
 * @version 1.0.0
 * @date 2019/2/26 18:18
 */
@RestController()
@RequestMapping(PersonController.PATH)
@Slf4j
public class PersonController {
    static final String PATH = "/person";

    @Resource
    private PersonService personService;

    @GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Person directFirstSend(@NotNull @PathVariable Long id) {
        return personService.getPersonById(id);
    }
}
